#       hello_world.rb
#       
#       Copyright 2010 mach1723 @ http://code.google.com/p/machs-code-sandbox/
#       
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later version.
#       
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.

def get_name?()
print(">>")

name = gets()

name = name.chop

if(name == "")
  print("Please enter a non empty name\n")
  name = get_name?()
  end

return name
end

def o_ruby(ntimes = 100)

index = 0

while index != ntimes

  print("Ruby Roks: times "+ String(index) +".\n")

  sleep(0.1)

  index += 1
  end

end

print("Hi world, enter the name of your favorite occupant\n")



name = get_name?()

if (name.length <= 4): 
	print("I dont like the name " +name+ "\n its too short .\n")

elsif (name.length >= 6) && (name.length <= 8)
	print("How do you pronounce that? "+name.chop+ "--"+name.chop+"-"+name +"?\n")

else
	print("Uh.... O_o.. "+ name +".\n")

end

print("Press Enter to see how nice ruby is")

gets()

o_ruby()
